<template>
  <van-cell is-link class="mycell" center>
    <template #icon>
      <!-- <i class="iconfont" v-html="icon">{{ icon }}</i>  这样写 不会被解析成字体图标 -->
      <i class="iconfont" v-html="icon"></i>
    </template>
    <!-- 左边的文字 -->
    <template #title>
      <div class="title">{{ title }}</div>
    </template>
    <!-- 右边的 -->
    <template #default>
      <img :src="baseUrl + value" alt="" v-if="type === 'img' && value" />
      <img src="@/assets/1.png" alt="" v-else-if="type === 'img' && !value" />
      <div class="value" v-else>{{ value }}</div>
    </template>
  </van-cell>
</template>

<script>
export default {
  props: ['title', 'value', 'icon', 'type'],
  data () {
    return {
      baseUrl: process.env.VUE_APP_baseURL
    }
  }
}
</script>

<style lang="less">
.mycell {
  .title {
    padding-left: 10px;
    font-size: 14px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: left;
    color: #181a39;
    line-height: 20px;
    letter-spacing: 0px;
  }
  .value {
    font-size: 14px;
    font-family: PingFangSC, PingFangSC-Regular;
    font-weight: 400;
    text-align: right;
    color: #5b5d75;
    line-height: 20px;
    letter-spacing: 0px;
  }
  img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
}
</style>
